<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // async 修饰的函数，返回的都是一个promise
      async function fn() {
        // return 1;
        // async 函数的返回值，会被Promise。resolve() 默认包装一下
        return Promise.resolve(11);
      }

      // const res = fn();
      // console.log(res);

      async function test() {
        // const res = await fn();
        // console.log(res);
        fn()
          .then((res) => {
            console.log(res);
          })
          .catch((err) => {});
      }

      test();
    </script>
  </body>
</html>
